//
//  MKAPIHttpFile.h
//  MKAPI
//  表单附件
//  Created by 苏尚进 on 2022/9/6.
//  Copyright © 2022 moon. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface MKAPIHttpFile : NSObject
@property(nonatomic,strong) NSString *name;//表单中name属性
@property(nonatomic,strong) NSString *fileName;//文件名称
@property(nonatomic,strong) NSString *mimeType;//使用filePath时，可以使用filePath.pathExtension.mkapi_contentTypeForPathExtension来获取

//以下为文件内容来源，优先级是inputStream>data>filePath
@property(nonatomic,strong,nullable) NSInputStream *inputStream;
@property(nonatomic,assign) NSInteger length;//inputStream配套使用
@property(nonatomic,strong,nullable) NSData *data;
@property(nonatomic,strong,nullable) NSString *filePath;
+ (MKAPIHttpFile *)fileWithName:(NSString *)name filePath:(NSString *)filePath;
+ (MKAPIHttpFile *)fileWithName:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType data:(NSData *)data;
@end

NS_ASSUME_NONNULL_END

NS_ASSUME_NONNULL_BEGIN
@interface MKAPIHttpFilesParam : NSObject
@property(nonatomic,readonly) NSArray<MKAPIHttpFile *> *files;
@property(nonatomic,readonly) MKAPIHttpFilesParam *(^P)(MKAPIHttpFile *file);
- (void)removeAll;
- (void)removeFile:(MKAPIHttpFile *)file;
@end
NS_ASSUME_NONNULL_END
